import assetRoutes from './asset-routes'
import spaceRoutes from './space-routes'
import procureRoutes from './procure-routes'
import home from '@/views/module/home/routes'
import playground from '@/views/playground/routes'
import { iframePath } from '@/util/iframe'

/**
 * 框架路由
 */
const skeletonRoute = {
  path: '/',
  component: () => import('@/views/skeleton/Skeleton'),
  children: [
    ...home,
    ...spaceRoutes,
    ...assetRoutes,
    ...procureRoutes,
    {
      path: `${iframePath}/:hash`,
      component: () => import('@/components/iframe/main'),
      meta: {
        title: 'iframe'
      }
    },
    {
      path: 'gen/dynamic/:dsName/:tableName',
      component: () => import('@/module/gen/dynamic')
    },
    {
      path: 'info/index',
      name: 'UserInfo',
      component: () => import('@/module/admin/user/info'),
      meta: {
        title: '个人信息'
      }
    },
    {
      path: 'flowDesign/:modelKey',
      name: 'FlowDesign',
      props: true,
      component: () => import('@/views/module/flow-designer/FlowDesign.vue'),
      meta: {
        title: '流程设计'
      }
    },
    {
      path: 'fileExplorer',
      name: 'FileExplorer',
      props: true,
      component: () => import('@/views/module/file/FileExplorer.vue'),
      meta: {
        title: '个人文件'
      }
    },
    {
      path: 'systemMessage',
      name: 'SystemMessage',
      props: true,
      component: () => import('@/views/module/message/SystemMessage.vue'),
      meta: {
        title: '系统消息'
      }
    },
    {
      path: 'admin/bulletin/bulletinForm/:id',
      name: '通知公告',
      props(route) {
        return { ...route.query, ...route.params }
      },
      component: () => import('@/module/admin/bulletin/bulletinForm'),
      meta: {
        title: '通知公告'
      }
    }
  ]
}

if (process.env.NODE_ENV !== 'production') {
  skeletonRoute.children.push(...playground)
}

export default skeletonRoute
